<!-- 熔岩流-面 -->
<template>
    <el-drawer v-model="addDrawer" size="50%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
        <template #title>
            <h2><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></h2>
            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading" v-if="isShowSave">保存</el-button>
            <el-button type="primary" @click="closeDrawer">关闭</el-button>
        </template>
        <template #default>
            <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="200px"
                v-loading="drawerLoading">
                <el-row justify="space-between">
                    <el-form-item label="省">
                        <el-input v-model="form.province" clearable disabled></el-input>
                    </el-form-item>
                    <el-form-item label="市">
                        <el-input v-model="form.city" clearable disabled></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="区/县">
                        <el-input v-model="form.county" clearable disabled></el-input>
                    </el-form-item>
                    <el-form-item label="熔岩流编号" prop="id">
                        <el-input v-model="form.id" placeholder="请输入熔岩流编号" clearable maxlength="17"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流名称" prop="name">
                        <el-input v-model="form.name" placeholder="请输入熔岩流名称" clearable maxlength="100"></el-input>
                    </el-form-item>
                    <el-form-item label="熔岩流符号代码" prop="type">
                        <el-input v-model="form.type" placeholder="请输入熔岩流符号代码" clearable maxlength="100"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流规模" prop="scope" style="width:100%">
                        <el-input v-model="form.scope" placeholder="请输入熔岩流规模" :autosize="{ minRows: 3, maxRows: 6 }"
                            type="textarea" show-word-limit maxlength="255" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流表面形态" prop="surfaceMorphology" style="width:100%">
                        <el-input v-model="form.surfaceMorphology" placeholder="请输入熔岩流表面形态" :autosize="{ minRows: 3, maxRows: 6 }"
                            type="textarea" show-word-limit maxlength="255" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流结构分带" prop="structureZone" style="width:100%">
                        <el-input v-model="form.structureZone" placeholder="请输入熔岩流结构分带" :autosize="{ minRows: 3, maxRows: 6 }"
                            type="textarea" show-word-limit maxlength="255" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流单元划分" prop="unit" style="width:100%">
                        <el-input v-model="form.unit" placeholder="请输入熔岩流单元划分" :autosize="{ minRows: 3, maxRows: 6 }"
                            type="textarea" show-word-limit maxlength="255" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流时代" prop="age">
                        <dict-select code="AgeCVD" :value="form.age" @update="val => form.age = val"></dict-select>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="熔岩流描述" prop="description" style="width:100%">
                        <el-input v-model="form.description" placeholder="请输入熔岩流描述" :autosize="{ minRows: 6, maxRows: 12 }"
                            type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="岩石类型" prop="rockType">
                        <dict-select code="RockTypeCVD" :value="form.rockType" @update="val => form.rockType = val"></dict-select>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="岩石名称" prop="rockName" style="width:100%">
                        <el-input v-model="form.rockName" placeholder="请输入岩石名称" :autosize="{ minRows: 3, maxRows: 6 }"
                            type="textarea" show-word-limit maxlength="255" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="岩性描述" prop="rockDescription" style="width:100%">
                        <el-input v-model="form.rockDescription" placeholder="请输入岩性描述" :autosize="{ minRows: 6, maxRows: 12 }"
                            type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="素描图图像编码" prop="sketchAiid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.sketchAiid" placeholder="素描图图像编码" clearable maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="sketchAiidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <ImageUpload v-model="form.sketchAiidName" @uploadImage="uploadSuccess('sketchAiid', $event)"
                                @delImage="deleteFile('sketchAiid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="素描图原始文件编码" prop="sketchArwid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.sketchArwid" placeholder="素描图原始文件编码" clearable maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="sketchArwidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <FileUpload v-model="form.sketchArwidName" @uploadFile="uploadSuccess('sketchArwid', $event)"
                                @delFile="deleteFile('sketchArwid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="照片文件编号" prop="photoAiid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.photoAiid" placeholder="照片文件编号" clearable maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="photoAiidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <ImageUpload v-model="form.photoAiidName" @uploadImage="uploadSuccess('photoAiid', $event)"
                                @delImage="deleteFile('photoAiid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="照片原始文件编号" prop="photoArwid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.photoArwid" placeholder="照片原始文件编号" clearable maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="photoArwidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <FileUpload v-model="form.photoArwidName" @uploadFile="uploadSuccess('photoArwid', $event)"
                                @delFile="deleteFile('photoArwid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="照片集镜向及拍摄者说明文档" prop="photoDescArwid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.photoDescArwid" placeholder="照片集镜向及拍摄者说明文档" clearable maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="photoDescArwidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <FileUpload v-model="form.photoDescArwidName" @uploadFile="uploadSuccess('photoDescArwid', $event)"
                                @delFile="deleteFile('photoDescArwid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="拍摄者" prop="photographer" style="width:100%">
                        <el-input v-model="form.photographer" placeholder="请输入备注" :autosize="{ minRows: 3, maxRows: 6 }"
                            type="textarea" show-word-limit maxlength="255" clearable></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="备注" prop="commentInfo" style="width:100%">
                        <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 6, maxRows: 12 }"
                            type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
                    </el-form-item>
                </el-row>
            </el-form>
        </template>
    </el-drawer>
</template>
<script setup>
// 引入基础方法
import useSpatialData from '@/hooks/useSpatialData';
// 引入表单验证规则
import { eightDouble, fourInt } from '@/utils/validate';
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, uploadSuccess, deleteFile, isShowSave } = useSpatialData();
// 表单验证规则
const formRules = {
    // id: [{ required: true, message: '请输入熔岩流编号！', trigger: 'blur' }],
    coneHeight: [eightDouble],
    craterDepth: [eightDouble],
    insideSlopeAngle: [eightDouble],
    outsideSlopeAngle: [eightDouble],
    bottomDiameter: [eightDouble],
    craterWallsDiameter: [eightDouble],
    craterDiameter: [eightDouble],
    depositThickness: [eightDouble],
    lavaDribletSize: [eightDouble],
    rockInclusionNum: [fourInt],
}
</script>
<style lang="scss" scoped></style>